package com.wyb.controller;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

//@WebServlet("/isLogin")
public class IndexController extends HttpServlet {
    //使用过滤器拦截强制访问后，该种方法已被弃用
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Object o = req.getSession().getAttribute("isLogin");
        PrintWriter pw = resp.getWriter();
        if(o!=null&&((String)o).equals("true")){
            pw.println(true);
        }else {
            pw.println(false);
        }
        pw.flush();
    }
}
